<template>
	<view class="index-box">
		<prod-list v-if="type == 1" :dataList='dataList'></prod-list>
		<ticket-list v-if="type == 2" :dataList='dataList'></ticket-list>
		<hotel-list v-if="type == 3" :dataList='dataList'></hotel-list>
		<line-list v-if="type == 4" :dataList='dataList'></line-list>
	</view>
</template>

<script>
	import prodList from '@/pagecomponents/prodList/index.vue';
	import lineList from '@/pagecomponents/lineList/index.vue';
	import hotelList from '@/pagecomponents/hotelList/index.vue';
	import ticketList from '@/pagecomponents/ticket/index.vue';
	export default{
		components:{
			prodList,
			lineList,
			hotelList,
			ticketList
		},
		data(){
			return{
				dataList:[],
				type:''
			}
		},
		onLoad(option){
			
			let obj={
				1:'商品列表',
				2:'门票列表',
				3:'酒店列表',
				4:'线路列表'
			}
			uni.setNavigationBarTitle({
			    title:obj[option.type]
			});
			this.type = option.type
			this.initPage(option.id,option.type)
		},
		methods:{
			initPage(pro_id,type){
				this.$loading()
				this.$resPost('GetCouponProductList',{
					pro_id,
					mode:type
				}).then(res=>{
					this.dataList = res.data
					this.$hide()
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.index-box{
		width: 100%;
	}
</style>
